Introducing Poseidon2

The upgraded hash function optimized for speed and ease-of-use in zero-knowledge applications

Horizen Labs Tech
3 min readApr 11, 2023

Efficient hash functions play a major role in modern zero-knowledge (ZK) settings. One of these hash functions, Poseidon, has found use in many of the currently used protocols, including Zcash and Mina. However, improvements can be made to its performance, functionality, and usability to adopt it for a wider range of applications. We identify those improvements and present Poseidon2, a faster version of Poseidon.

To advance the application and adoption of zero-knowledge technology, Horizen Labs collaborated with Ethereum Foundation and Ponos Technology on Poseidon2. For more details we refer to the full paper.

Hash Functions in ZK Settings and Poseidon

In zero-knowledge (ZK) settings, hash functions are important for ensuring the accuracy and security of information. There are several efficient hash functions used in ZK settings, including Poseidon, Rescue, Griffin, and Anemoi. Among these, Poseidon is the most widely used and is found in many ZK protocols like our ginger-lib library used in our chain network.

Compared to traditional hash functions like SHA-2, Poseidon is much more efficient in ZK settings. However, its performance outside of the proving system is still a bit slow because of its complex internal components. To address this issue, we have developed a new version of Poseidon called Poseidon2, which is faster and more efficient.

What is Poseidon2?

Poseidon2 is a new and improved version of Poseidon, a popular hash function used in many zero-knowledge protocols. Poseidon2 is designed to be faster and more efficient than the original version.

One of the benefits of Poseidon2 is that it’s easier to use. It can be used like any other hash function, but we also recommend using it with a more efficient compression function, especially when computing Merkle trees.

Another advantage of Poseidon2 is that it’s simpler and more memory-efficient than the original version. This means it can achieve maximum performance without requiring any changes to the algorithm, which was not the case for the original Poseidon.

Applications

We recommend using Poseidon2 in all use cases where Poseidon has proven its efficiency in the last couple of years. Comparing the original Poseidon and Poseidon2 in various popular settings, we observe that the latter gives a performance boost by a factor of up to 4. This makes Poseidon2 currently one of the fastest hash functions optimized for zero-knowledge applications.

In particular, together with the newly recommended compression mode, Poseidon2 is significantly more efficient for Merkle tree computations. We see a plain performance improvement over the original Poseidon in sponge mode by a factor of up to 5, while at the same time being around 30% more efficient in proving systems.

Conclusion

With Poseidon2, we improve the state of the art in fast hashing for zero-knowledge use cases. We achieve our goals by optimizing various internal components of the original Poseidon hash function, and we also show that our modifications do not decrease the advertised security level.

Markus Schofnegger, mschofnegger@horizenlabs.io

Further Reading

For a technical deep-dive, check out Faster Hashing in Zero-Knowledge Settings.

Poseidon: https://eprint.iacr.org/2019/458
Poseidon2: https://eprint.iacr.org/2023/323
Rescue: https://eprint.iacr.org/2019/426
Griffin: https://eprint.iacr.org/2022/403
Anemoi: https://eprint.iacr.org/2022/840
plonky2: https://polygon.technology/blog/introducing-plonky2

--

--

Horizen Labs Tech

Sharing learnings in blockchain security and industry-leading cryptography research